package com.example.sample.control;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.Toast;

public class MyImageView extends ImageView {
	
	private String TAG = "MyImageView";
	private boolean shown = false;

	public MyImageView(Context context) {
		super(context);		
	}

	public MyImageView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public MyImageView(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);
	}

	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		
		if (!shown){
			shown = true;
			
			String content = "onDraw canvas width="+ canvas.getWidth() + " height = " + canvas.getHeight();
			Toast.makeText(getContext(), content, Toast.LENGTH_SHORT).show();
		}
	}
}
